package com.jotta.client.communicate;

import com.jotta.client.setting.ModeOfApplication;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;

public class Configuration {


    public static String INITIAL_CLIENT_PATH = "/JottaMobile/";
    public static String PREFS_NAME = "JottaPrefsFile";

    /////////////////////////////////////////////////////////////////////////////

    public static final String SERVER_HOST = "www.jotta.no";
    public static final String INITIAL_SERVER_PATH = "https://www.jotta.no/jfs/";

    public static final String JOTTA_DEVICE = "Jotta";
    public static final String JOTTA_DEVICE_TYPE = "JOTTA";
    public static final String ARCHIVE_NAME = "Archive";

    public static final String JOTTA_ARCHIVE_PATH = "/Jotta/Archive";
    public static final String SLASH = "/";

    public static final String FILE_PATH = "FilePath";
    public static final String FILE_NAME = "FileName";
    public static final String GET_DATA_SUCCESSFUL_MESSAGE = "Success";
    public static final String LOAD_PICTURE_SUCCESSFUL_MESSAGE = "LoadPictureSucess";
    public static final String SERVER_MESSAGE_KEY = "Message";
    public static final String LOAD_PICTURE_MESSAGE_KEY = "Message";
    public static final String STOP_DOWNLOAD_THREAD_MESSAGE_KEY = "Message";
    public static final String CLIENT_ERROR_MESSAGE_KEY = "Message";
    public static final String LOCAL_FILE_PATH = "Message";
    public static final String PROGRESS_BAR_PERCENT = "Progress";
    public static final String DOWNLOAD_HEADER = "DownloadHeader";
    public static final String SWIPE_PATH = "SwipePath";


    private static Resources res;
    private static SharedPreferences references;
    private static ModeOfBrowse modeOfBrowse;
    private static ModeOfApplication modeOfApplication = ModeOfApplication.FULL_OPTION;
    private static ModeOfSeverCommunicate modeOfSeverCommunicate = ModeOfSeverCommunicate.GET_SERVER_INFOMATION;
    private static StateOfClient stateOfClient = StateOfClient.OFFLINE;


    public static void prepareConfiguration(Context context) {
        setRes(context.getResources());
        setReferences(context.getSharedPreferences(PREFS_NAME, 0));
    }

    /**
     * @param res the res to set
     */
    public static void setRes(Resources res) {
        Configuration.res = res;
    }

    /**
     * @return the res
     */
    public static Resources getRes() {
        return res;
    }

    /**
     * @param references the references to set
     */
    private static void setReferences(SharedPreferences references) {
        Configuration.references = references;
    }

    /**
     * @return the references
     */
    public static SharedPreferences getReferences() {
        return references;
    }

    /**
     * @param modeOfBrowse the modeOfBrowse to set
     */
    public static void setModeOfBrowse(ModeOfBrowse modeOfBrowse) {
        Configuration.modeOfBrowse = modeOfBrowse;
    }

    /**
     * @return the modeOfBrowse
     */
    public static ModeOfBrowse getModeOfBrowse() {
        return modeOfBrowse;
    }

    /**
     * @param modeOfApplication the modeOfApplication to set
     */
    public static void setModeOfApplication(ModeOfApplication modeOfApplication) {
        Configuration.modeOfApplication = modeOfApplication;
    }

    /**
     * @return the modeOfApplication
     */
    public static ModeOfApplication getModeOfApplication() {
        return modeOfApplication;
    }

    /**
     * @param modeOfSeverCommunicate the modeOfSeverCommunicate to set
     */
    public static void setModeOfSeverCommunicate(ModeOfSeverCommunicate modeOfSeverCommunicate) {
        Configuration.modeOfSeverCommunicate = modeOfSeverCommunicate;
    }

    /**
     * @return the modeOfSeverCommunicate
     */
    public static ModeOfSeverCommunicate getModeOfSeverCommunicate() {
        return modeOfSeverCommunicate;
    }

    /**
     * @param stateOfClient the stateOfClient to set
     */
    public static void setStateOfClient(StateOfClient stateOfClient) {
        Configuration.stateOfClient = stateOfClient;
    }

    /**
     * @return the stateOfClient
     */
    public static StateOfClient getStateOfClient() {
        return stateOfClient;
    }

}
